import flask
import json
from db.mongo_db import MongoDB

app = flask.Flask(__name__)


@app.route('/one')
def get_one():
    proxies = MongoDB().get(1)
    result = [proxy['proxy'] for proxy in proxies]
    return json.dumps(result)


@app.route('/many')
def get_many():
    args = flask.request.args
    proxies = MongoDB().get(args['count'])
    result = [proxy['proxy'] for proxy in proxies]
    return json.dumps(result)


def run():
    app.run()
